<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@page import="com.chilli.cosima.common.page.PagerBean"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <s:if test="#request.pagerBean.total>1">

      <tr>
      
	      		<s:if test="#request.pagerBean.currentPage > #request.pagerBean.total">
					<td align="right">
						第一页
						上一页
						下一页
						最后一页
						第
						<span class="text_red"><s:property value="#request.pagerBean.currentPage" /></span>/<s:property value="#request.pagerBean.total" />
						跳转到
						<input type="text" class="INPUT8" id="goPage" />
						页
						&nbsp;
					</td>
					<td width="25" align="right">
						<input name="Submit23" type="button" class="button_small"
							value="GO"
							onclick="validatePageNum();" />
					</td>
				</s:if>
				  
      
				<s:if test="#request.pagerBean.currentPage <= #request.pagerBean.total">
							
				<td align="right">
				
				
					<s:if test="#request.pagerBean.currentPage == #request.pagerBean.firstPage">
						第一页
						上一页
					</s:if>
					
					
					<s:if test="#request.pagerBean.currentPage != 1">
						<span class="pager_span" onclick="doPager('1');"> 第一页
						</span>
						<span class="pager_span" onclick="doPager('<s:property value="#request.pagerBean.previousPage" />');">上一页
						</span>
					</s:if>

					<s:if test="#request.pagerBean.currentPage == #request.pagerBean.lastPage">
						下一页
						最后一页
					</s:if>
					
					
					<s:if test="#request.pagerBean.currentPage != #request.pagerBean.lastPage">
						<span class="pager_span" onclick="doPager('<s:property value="#request.pagerBean.nextPage" />');">下一页
						</span>
						<span class="pager_span" onclick="doPager('<s:property value="#request.pagerBean.lastPage" />');">最后一页
						</span>
					</s:if>

					<script type="text/javascript">
					var cp = '<s:property value="#request.pagerBean.currentPage" />';
					var mp = '<s:property value="#request.pagerBean.total" />'
					
					if(cp<=0){
					document.write('第<span class="text_red">1</span>');
					}
					else{
						if(cp>mp)
						{
						document.write('第<span class="text_red">'+mp+'</span>/<s:property value="#request.pagerBean.total" /> 页');
						}
						else
						{
						document.write('第<span class="text_red">'+cp+'</span>/<s:property value="#request.pagerBean.total" /> 页');
						}
					}
					</script>
					跳转到
					<input type="text" size="1" id="goPage" />
					页
					&nbsp;
				</td>
				<td width="25" align="right">
					<input name="Submit23" type="button" class="button_small" value="GO" onclick="validatePageNum();" />
				</td>
				
			</s:if>
			
		<script type="text/javascript" language="javascript">
		
			function doPager(pageNum)
			{
				myForm = document.getElementById('form');
				myForm.method = "post";
				myForm.action = "<s:property value='#request.pagerBean.action'/>?page="+pageNum;		
				myForm.submit();
			}
			
			function validatePageNum()
			{
				var number = /^\d+$/;
				
				'<s:if test="#request.pagerBean == null">'
					var total = 0;
				'</s:if>'

				'<s:if test="#request.pagerBean != null">'
					var total = '<s:property value="#request.pagerBean.total" />';
				'</s:if>'
				
				var page = document.getElementById('goPage').value;
				
				if(page < 1 || !number.test(page))
				{
					alert('输入参数非法');
					return;
				}
				if(total < page)
				{
					alert('输入超过最大页数');
					return;
				}
				doPager(document.getElementById('goPage').value);
			}
		</script>
	</tr>
	</s:if>	
</table>
